<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <ui:composition template="/template.xhtml">
        <ui:define name="body">
            <h:body>
                <script type="text/javascript" src="resources/geocode.js"/>
                <script  type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;region=UA&amp;language=ru" />
                <h:form id="buttons">
                    <input type="button" value="Geocode" onclick="geocode()"/>
                </h:form>
                <h:form id="update" prependId="false">
                    <h:inputText id="id" value="#{addressLookup.id}"/>
                    <h:inputText id="adr" value="#{addressLookup.address}"/>
                    <h:inputText id="lat" value="#{addressLookup.lat}"/> : <h:inputText id="lng" value="#{addressLookup.lng}"/>
                    <h:commandButton id="updateLocation" >
                        <f:ajax event="click" execute=":update" listener="#{addressLookup.updateAdvertLocation}"/>
                    </h:commandButton>
                </h:form>
                <h:form id="dbdump" prependId="false">
                    <h:dataTable id="advs" var="adv" value="#{advertController.loadZeroLocatrion()}">
                        <h:column>
                            #{adv.id}
                        </h:column>
                        <h:column>
                            #{adv.address}
                        </h:column>
                        <h:column>
                            [#{adv.lat} : #{adv.lng}]
                        </h:column>
                    </h:dataTable>
                </h:form> 

            </h:body>
        </ui:define>
    </ui:composition>
</html>

